var mySwiper = new Swiper('.swiper-container',{
		effect:'fade'
	});
	$(".btn1").on("click",function(){
		mySwiper.slideTo(0,1000,false);
	});
	$(".btn2").on("click",function(){

		mySwiper.slideTo(1,1000,false);
	});
	$('.container > img').cropper();
	var canvas=document.getElementsByTagName("canvas")[0];
	var ctx = canvas.getContext("2d");
	
	$("button").eq(0).click(function(){
	var obj = $('.container > img').cropper('getData');	
	ctx.drawImage(img1,obj.x,obj.y,obj.width,obj.height,0,0, 260, 150);	
	console.log(obj);
});

$("button").eq(1).click(function(){
	ctx.clearRect(0,0,260,150);
});

$("button").eq(2).click(function(){	
	var imgData = canvas.toDataURL("image/png");
	console.log(imgData);
});
$(".span1").on("click",function(){
	mySwiper.slideTo(0,1000,false);
});
$(".span2").on("click",function(){
	mySwiper.slideTo(2,1000,false);
});
$(".soccernow").on("click",function(){
	mySwiper.slideTo(3,1000,false);
});
$(".btn3").on("click",function(){
	mySwiper.slideTo(4,1000,false);
});
$(".tx").on("click",function(){
	mySwiper.slideTo(5,1000,false);
});
$(".opnav1").on("click",function(){
	mySwiper.slideTo(3,1000,false);
});
$(".opnav2").on("click",function(){
	mySwiper.slideTo(0,1000,false);
});
$(".opnav3").on("click",function(){
	mySwiper.slideTo(0,1000,false);
});

var disblo = document.getElementById("disblo");
var userintro = document.getElementById("userintro");
var cover = document.getElementById("cover");
var thecover = document.getElementById("thecover");
var nav = document.getElementById("nav");
var ttlog = document.getElementsByClassName("log")[0];
var thelog = document.getElementById("thelog");
var toclose = document.getElementsByClassName("toclose")[0];
var logtoreg = document.getElementsByClassName("logtoreg")[0];
var thereg = document.getElementById("thereg");
var reg1 = document.getElementsByClassName("reg1")[0];
var reg2 = document.getElementsByClassName("reg2")[0];
var tx = document.getElementsByClassName("tx")[0];
var thebody = document.getElementById("body");

disblo.onclick = function(){
	userintro.style.display = "block";
	cover.style.display = "block";
}
cover.onclick = function(){
	userintro.style.display = "none";
	cover.style.display = "none";
}
		
ttlog.onclick = function(){
	thecover.style.display = "block";
	thelog.style.display = "block";
}
toclose.onclick = function(){
	thecover.style.display = "none";
	thelog.style.display = "none";
}
logtoreg.onclick = function(){
	thelog.style.display="none";
	thereg.style.display = "block";
}
reg1.onclick = function(){
	thecover.style.display = "none";
	thereg.style.display = "none";
	thelog.style.display = "none";
}
reg2.onclick = function(){
	thecover.style.display = "none";
	thereg.style.display = "none";
	thelog.style.display = "none";
}
thebody.onscroll=function(){
	var scrollTop=thebody.scrollTop;
if(scrollTop>10){
	nav.style.opacity="0.7";
	nav.style.position = "absolute";
	nav.style.top = "5rem"
}else{
	nav.style.opacity="1";
	nav.style.position = "relative";
	nav.style.top = "0rem"
}
}
//搜索框
function Change(str){
	document.getElementById("word").value=str;
	document.getElementById("div1").style.display="none";
}
var arr;
var url="word.json?t="+new Date().getTime();//数据
ajax.post(url,"x=2", function(str){//ajax
	arr=eval("("+str+")").list;//得到数组
});	
var theword = document.getElementById("word");
theword.onkeyup = function (){
	var word=document.getElementById("word").value;//得到文本域中的值
	var div1=document.getElementById("div1");//得到提示菜单div
	div1.innerHTML="";//提示菜单清空内容。如果不做清空，数据将累加。
	if(word!=""){//当文本域中的值为空时
		var reg=eval("/"+word+"/gi");//声明正则
		for(var i=0; i<arr.length; i++){//遍历
			var obj=arr[i];//得到对象
			var txt=obj.key;	//指 列表中具体的一项
			var col=txt.match(reg);	//根据正则取出匹配的结果
			if(col){//当数组存在时
				t2=txt;
				a2=txt.split(reg);
				s2="";
				for(var j=0; j<col.length; j++){
					s2 += a2[j]+"<font color=red>"+col[j]+"</font>"					
				}		
				s2+=a2[j];
				txt="<div onclick=\"Change('"+obj.key+"')\" style='border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;height:4rem;line-height:4rem'>"+s2+"</div>";//绑定单击事件

				div1.innerHTML+=txt;
			}
		}	
		if(div1.innerHTML!=""){
			div1.style.display="block";
		}		
	}else{
		div1.style.display="none";
	}
}
//拍照
